Config Entry
An entry for a config setting list. Presents the setting name, any prefix text, as well as content buttons and decorations.
Author
fzzyhmstrs
Since
0.6.0
Parameters
DynamicListWidget the settings widget the entry is being added to. This is provided internally; Fzzy Config asks for instances of Function$lt;DynamicListWidget, ConfigEntry> so it can finish construction lazily when needed.
ContentBuilder.BuildResult built contents of this entry.
Translatable.Result translation information for this entry. This is provided by EntryCreator.CreatorContext
See also
Samples
import me.fzzyhmstrs.fzzy_config.config.ConfigGroup
import me.fzzyhmstrs.fzzy_config.entry.EntryCreator
import me.fzzyhmstrs.fzzy_config.screen.decoration.Decorated
import me.fzzyhmstrs.fzzy_config.screen.widget.DynamicListWidget
import me.fzzyhmstrs.fzzy_config.screen.widget.LayoutWidget
import me.fzzyhmstrs.fzzy_config.screen.widget.TextureDeco
import me.fzzyhmstrs.fzzy_config.screen.widget.TooltipChild
import me.fzzyhmstrs.fzzy_config.screen.widget.custom.CustomButtonWidget
import me.fzzyhmstrs.fzzy_config.util.FcText
import me.fzzyhmstrs.fzzy_config.util.FcText.translate
import me.fzzyhmstrs.fzzy_config.util.Ref
import net.minecraft.client.gui.widget.ClickableWidget
import net.minecraft.text.Text
import java.util.function.BiFunction
import java.util.function.Consumer
fun main() {
//sampleStart
val function: BiFunction<DynamicListWidget, Int, out DynamicListWidget.Entry> = BiFunction { listWidget, _ ->
val contentBuilder = ConfigEntry.ContentBuilder(context, context.actions.map { ConfigEntry.ActionDecorationWidget.config(it) })
contentBuilder.decoration(TextureDeco.DECO_OPEN_SCREEN, 2, 2)
contentBuilder.layoutContent { contentLayout ->
contentLayout.add(
"open_screen",
CustomButtonWidget.builder(context.texts.name) { context.misc.get(OPEN_SCREEN)?.accept(context.scope) }
.narrationSupplier { _ -> context.texts.name.copyContentOnly() }
.width(110)
.build(),
LayoutWidget.Position.ALIGN_JUSTIFY,
LayoutWidget.Position.BELOW)
}
ConfigEntry(listWidget, contentBuilder.build(), context.texts)
}
return listOf(EntryCreator.Creator(context.scope, context.texts, function))
//sampleEnd
}
Constructors
Types
A decoration widget that renders an action icon from an Action and displays its tooltip
Builds content information for constructing a ConfigEntry
Properties
Functions
Handle a context event. This will be triggered by a parent, typically on key press or mouse click. A parent object can of course also be a context handler, handle context as applicable and then pass the event downstream for further handling.
Indicates that the overlay has been removed and the parent should return focus to the cached element, if any, in lastSelected
Add a set of grouped context action builders to a result
Indicates to the parent element to cache it's current focused element. The current focused element should be stored in lastSelected
When called the parent element should reselect a hovered element based on the supplied mouse positions, if it tracks such things